#include "CircleWave.h"
#include "CharacterId.h"
#include "GameMath.h"
#include "../manager/WaveManager.h"
#include "../data/Creator.h"

CircleWave::CircleWave()
{
    timer.waitTime = 10;
    timer.onTimeout = [this] {
        if (GameInfo::Instance().enemies.size() >= 100) return;
        count ++;
        if (count > maxCount) count = maxCount;
        for (int i = 0; i < count; i++) {
            auto id = (CharacterId)GameMath::RandomInt(CharacterId::CHARACTER_END - 1);
            auto enemy = Creator::CreateHero(id);
            WaveManager::Instance().AddBirthQueue(enemy);
        }
    };
}

void CircleWave::OnUpdate(double delta)
{
    timer.OnUpdate(delta);
}
